const mongodb = require('./mongodb');
const Schema = mongodb.mongoose.Schema;//模式，策略
const MessageSchema = new Schema({
    msgId:String,
    msgType:String,
    title:String,
    target:String,//目标设备
    isWrap:Boolean,//完整信息不需要拉出去
    receive:Boolean,//设备保持长连接即认为接收成功
    extras:{},//直接推送到设备的集合
    create_date:{type:date,default:Date.now()}
});
/**
 * [save description]插入一条记录
 * @param {[type]} obj [description] obj即json对象
 * 
 * @param {Function} callback[description]
 * 
 * @param {[type]} [description]
 * 
 * 
*/
MessageDAO.prototype.save = function(obj,callback){
    var instance = new Message(obj);
    instance.save(function(err){
        callback(err);
    })
}
module.exports = new MessageDAO();